package ru.acme.lab08.task1;

import java.lang.NumberFormatException;

class Task1Calculator {
	public static void main(String[] args) {
		if (args.length < 3) {
			System.out.println("Not enough arguments");
			return;
		}
		Double operand1, operand2;
		try {
			operand1 = Double.parseDouble(args[0]);
			operand2 = Double.parseDouble(args[2]);
		} catch (NumberFormatException e) {
			System.out.println("Bad operands");
			return;		
		}
		Character operation = args[1].charAt(0);
		Double result;
		switch (operation) {
			case '+':
				result = operand1 + operand2;
				break;
			case '-':
				result = operand1 - operand2;
				break;
			case '*':
				result = operand1 * operand2;
				break;
			case '/':
				if (Math.abs(operand2) < 1e-16) {
					System.out.println("Division by zero");
					return;		
				}
				result = operand1 / operand2;
				break;
			default:
				System.out.println("Bad operation");
				return;		
		}
		System.out.println(result);
	}
}